package com.hspedu.homework.Homework01;

/**
 * @author DL5O
 * @version 1.0
 */
public class Homework01 {
    public static void main(String[] args) {
        try {
            if (args.length !=2){
                throw new ArrayIndexOutOfBoundsException("参数个数需为2个..");
            }
            int n1 = Integer.parseInt(args[0]);
            int n2 = Integer.parseInt(args[1]);
            int ret = cal(n1,n2);
            System.out.println("计算结果为:" + ret);
        }catch (ArithmeticException e){
            System.out.println("算术异常，除数为0..");
        }
        catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("参数个数需为2个..");
        } catch (NumberFormatException e) {
            System.out.println("数据格式有误");
        }

    }

    private static int cal(int n1, int n2)  {
        return n1/n2;
    }

}
